import os
import syscall
import time
import fmt

bool verbose = false

fn set_verbose() {
    verbose = true
    logf('verbose enabled')
}

fn logf(string format, ...[any] args) {
    if !verbose {
        return
    }
    var msg = fmt.sprintf(format, ...args)
    var t = time.now()
    fmt.printf('log: %v time: %v\n', msg, t.datetime())
}

fn assertf(bool cond, string format, ...[any] args) {
    if !cond {
        var msg = fmt.sprintf(format, ...args)

        var t = time.now()
        fmt.printf("failed: %v time:%v\n", msg, t.datetime())

        syscall.exit(1)
    }
}
